//
//  AppDelegate.h
//  Dispatch
//
//  Created by hyeyeon on 14. 1. 13..
//  Copyright (c) 2014년 hyeyeon. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
#import <FacebookSDK/FacebookSDK.h>

#import "ViewController.h"

#import "PopupView.h"
#import "LayerPUView.h"

//sdk
#import "ManInterstitial.h"

//network
#import "UIImageView+AFNetworking.h"
#import "AFHTTPRequestOperationManager.h"
//#import "NSData+Base64.h"

//uuid
#import "OpenUDID.h"

//aes
#import "NSData+AES.h"
#import "NSData+Base64.h"
#import "NSString+Base64.h"

//image cache
#import "CacheMemory.h"


#import "GAI.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"

#import "EGORefreshTableHeaderView.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate, PopupViewDelegate, ManInterstitialDelegate>
{
    NSInteger notiType;     //0:공지사항없음, 1:팝업, 2:레이어팜업
    NSInteger notiSubType;  //팝업링크
    NSInteger adFlag;       //전면광고 노출여부 1:전면광고 띄움

    CacheMemory *cacheMemory;   //캐쉬메모리 관리
    
    LayerPUView *layerPU;
    
    //activity
    UIView *activityBGView;
    UIActivityIndicatorView *activityView;
    
    

}
@property (strong, nonatomic) UIWindow *window;

//data
@property (nonatomic, strong) NSMutableData *responseData;
@property (nonatomic, retain) NSArray *autoSearchArray; //자동완성
@property (nonatomic, retain) NSArray *keywordsArray;   //순위
@property (nonatomic, retain) NSArray *iconsArray;      //리본아이콘
@property (nonatomic, retain) NSString *notiContent;
@property (nonatomic, assign) NSInteger issueAdCount;
@property (nonatomic, assign) NSInteger starAdCount;
@property (nonatomic, assign) NSInteger battleAdCount;
@property (nonatomic, assign) NSInteger battleAdTime;
@property (nonatomic, retain) NSDictionary *receieveDic;
@property (nonatomic, retain) NSString *mToken;

@property (nonatomic, retain) NSString *currentLanguage;    //언어

//아이콘
@property (nonatomic, retain) NSMutableDictionary *iconDictionary;

//loading
-(void)appearActivityOnPoint:(CGPoint)point;
-(void)removeActivity;


//네트워크
-(BOOL)connectedToNetwork;
-(void)requestURL:(NSString*)url;       //요청
-(BOOL)checkObject:(id)object;  //데이터 있는지 확인

- (void) loadAsyncImageFromURL:(NSURL *)url  imageBlock:(void (^) (UIImage *image))imageBlock errorBlock:(void(^)(void))errorBlock;  //이미지 부를때

- (void) loadAsyncImageFromDomain:(NSString *)domain andFileName:(NSString*)fileName imageBlock:(void (^) (UIImage *image))imageBlock errorBlock:(void(^)(void))errorBlock; //이미지 부름
- (void) loadAsyncImageFromURLString:(NSString *)urlString  imageBlock:(void (^) (UIImage *image))imageBlock errorBlock:(void(^)(void))errorBlock;  //이미지부름
-(void)removeCacheMemory;   //메모리지우기

//레이어팝업
-(void)showLayerPUViewWithURL:(NSString*)url;
-(void)confirmLayerPU;

//버튼없는팝업
-(void)alertViewWithMessage:(NSString*)message andTimeInterval:(NSTimeInterval)time;

//미디어타입
-(NSString*)setMediaType:(NSString*)string;

//html 인코딩
-(NSString*)stringByHTMLEncodingWithString:(NSString*)_string;

//애널리틱스
-(void)analyticsScreen;
-(void)analyticsCategory:(NSString*)cate Action:(NSString*)act Label:(NSString*)label;

//암호화
-(NSString*)encryptDataURLString:(NSString*)str;
-(NSString*)decryptDataURLString:(NSString*)str;

//페이드아웃
-(void)effectFaceoutTargetView:(UIView*)tView;

//네트워크 에러시 띄어줄 팝업
-(void)appearNetworkError;

//인터넷 연결
-(void)appearNetworkErrorView;

//network
-(void)getImgDownload:(NSString*)imgurl setImage:(id)image;
-(void)getRequestTest:(NSString*)url;
@end

